﻿using System;
using System.Collections.Generic;
namespace DbFrame.SqlContext.Abstract
{
    //
    using DbFrame.SqlContext.Interface;
    using DbFrame.Class;
    using System.Linq.Expressions;

    public abstract class AbstractUpdate : BaseClass, IUpdate
    {
        //根据 拉姆达表达式 作为 Where 条件
        public abstract bool Update<T>(T Set, Expression<Func<T, bool>> Where) where T : class, new();

        public abstract bool Update<T>(Expression<Func<T>> Set, Expression<Func<T, bool>> Where) where T : class, new();

        public abstract bool Update<T>(T Set, Expression<Func<T, bool>> Where, List<SQL> li) where T : class, new();

        public abstract bool Update<T>(Expression<Func<T>> Set, Expression<Func<T, bool>> Where, List<SQL> li) where T : class, new();


        //根据ID 作为 Where 条件
        public abstract bool UpdateById<T>(T Set) where T : class, new();

        public abstract bool UpdateById<T>(Expression<Func<T>> Set) where T : class, new();

        public abstract bool UpdateById<T>(T Set, List<SQL> li) where T : class, new();

        public abstract bool UpdateById<T>(Expression<Func<T>> Set, List<SQL> li) where T : class, new();

        //根据sql 语句操作
        public abstract bool UpdateCustomSet<T>(Expression<Func<T, object>> Set, Expression<Func<T, bool>> Where) where T : class, new();

        public abstract bool UpdateCustomSet<T>(Expression<Func<T, object>> Set, Expression<Func<T, bool>> Where, List<SQL> li) where T : class, new();

        bool IUpdate.Update<T>(T Set, Expression<Func<T, bool>> Where)
        {
            return Update<T>(Set, Where);
        }

        bool IUpdate.Update<T>(Expression<Func<T>> Set, Expression<Func<T, bool>> Where)
        {
            return Update<T>(Set, Where);
        }

        bool IUpdate.Update<T>(T Set, Expression<Func<T, bool>> Where, List<Class.SQL> li)
        {
            return Update<T>(Set, Where, li);
        }

        bool IUpdate.Update<T>(Expression<Func<T>> Set, Expression<Func<T, bool>> Where, List<Class.SQL> li)
        {
            return Update<T>(Set, Where, li);
        }

        bool IUpdate.UpdateById<T>(T Set)
        {
            return UpdateById<T>(Set);
        }

        bool IUpdate.UpdateById<T>(Expression<Func<T>> Set)
        {
            return UpdateById<T>(Set);
        }

        bool IUpdate.UpdateById<T>(T Set, List<Class.SQL> li)
        {
            return UpdateById<T>(Set, li);
        }

        bool IUpdate.UpdateById<T>(Expression<Func<T>> Set, List<Class.SQL> li)
        {
            return UpdateById<T>(Set, li);
        }

        bool IUpdate.UpdateCustomSet<T>(Expression<Func<T, object>> Set, Expression<Func<T, bool>> Where)
        {
            return UpdateCustomSet<T>(Set, Where);
        }

        bool IUpdate.UpdateCustomSet<T>(Expression<Func<T, object>> Set, Expression<Func<T, bool>> Where, List<SQL> li)
        {
            return UpdateCustomSet<T>(Set, Where, li);
        }


    }
}
